<template>
	<view class="content">
		<u-navbar :title="pageTitles[pageIndex]" placeholder leftText='1' bgColor='#fff'
			:titleStyle="titleStyle" fixed>
			<view slot='left' v-show="pageIndex==0">
				<image @click="handleNavToSelectMap" src="/static/images/map-select.png" style="width:50rpx;height:50rpx"></image>
			</view>
		</u-navbar>

		<TouristPageIndex @changePageIndex='handleChangePageIndex' v-if='pageIndex==0' />
		<!-- <AdminPageIndex v-if='pageIndex==0' /> -->

		<ScenicSpotList v-if='pageIndex==1' />
		<AddOpera v-if='pageIndex==2' />
		<MineMessage v-if="pageIndex==3"/>
		<Mine v-if='pageIndex==4' />

		<u-tabbar activeColor="rgb(56,167,128)" :value="pageIndex" @change="handleChangePageIndex" :fixed="true"
			:placeholder="true" :safeAreaInsetBottom="true">
			<u-tabbar-item text="首页">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/images/tabbar1-s.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/images/tabbar1.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="景点">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/images/tabbar2-s.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/images/tabbar2.png"></image>
			</u-tabbar-item>
			<u-tabbar-item>
				<view slot="text" class="add-m">
					<image class="u-page__item__slot-icon" src="/static/images/tabbar3.png"></image>
				</view>
			</u-tabbar-item>
			<u-tabbar-item text="消息">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/images/tabbar4-s.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/images/tabbar4.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="我的">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/images/tabbar5-s.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/images/tabbar5.png"></image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	import TouristPageIndex from "./components/touristPageIndex/index.vue"
	import AdminPageIndex from "./components/adminPageIndex/index.vue"

	import ScenicSpotList from "./components/scenicSpotList/index.vue"
	import AddOpera from "./components/addOpera/index.vue"
	import Mine from "./components/mine/index.vue"
	import MineMessage from "./components/mineMessage/index.vue"
	export default {
		components: {
			TouristPageIndex,
			AdminPageIndex,
			ScenicSpotList,
			AddOpera,
			MineMessage,
			Mine
		},
		data() {
			return {
				titleStyle: {
					color: "rgb(46,167,128)"
				},
				pageIndex: 0,
				pageTitles: [
					'首页',
					'景点',
					'',
					'消息',
					'我的'
				]
			}
		},
		onLoad() {

		},
		methods: {
			handleChangePageIndex(e) {
				this.pageIndex = e
			},
			handleNavToSelectMap(){
				uni.reLaunch({
					url:"/pages/mapSelectIndex/mapSelectIndex"
				})
			}
		}
	}
</script>

<style lang="scss">
	.add-m {
		box-sizing: border-box;
		border-radius: 50%;

		image {
			width: 90upx;
			height: 90upx;
			margin-top: -60upx;
		}
	}

	.u-page__item__slot-icon {
		width: 40upx;
		height: 40upx;
	}
</style>
